home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / csstray / csstray.exe / _SETUP.1 / frmEx2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-25  |  8.2 KB  |  217 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#8.0#0"; "csstray.ocx"
  4. Begin VB.Form frmEx2 
  5.    Caption         =   "SysTray Example Application #2"
  6.    ClientHeight    =   3255
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   5295
  10.    Icon            =   "frmEx2.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   3255
  14.    ScaleWidth      =   5295
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin csSysTrayCtl.csSysTray csSysTray1 
  18.       Left            =   4080
  19.       Top             =   2040
  20.       _ExtentX        =   2064
  21.       _ExtentY        =   1111
  22.       TrayIcon        =   "frmEx2.frx":0442
  23.       TrayTip         =   "Click this icon to zoom the window to/from the system tray!"
  24.       p_RegCode       =   "frmEx2.frx":0894
  25.    End
  26.    Begin VB.CommandButton cmdAnimate 
  27.       Caption         =   "Animate Icon"
  28.       Height          =   375
  29.       Left            =   2040
  30.       TabIndex        =   4
  31.       Top             =   2760
  32.       Width           =   1575
  33.    End
  34.    Begin VB.CommandButton cmdZoomToTray 
  35.       Caption         =   "&Zoom to Tray"
  36.       Height          =   375
  37.       Left            =   120
  38.       TabIndex        =   3
  39.       Top             =   2760
  40.       Width           =   1695
  41.    End
  42.    Begin VB.CommandButton cmdClose 
  43.       Cancel          =   -1  'True
  44.       Caption         =   "&Close"
  45.       Height          =   375
  46.       Left            =   4080
  47.       TabIndex        =   1
  48.       Top             =   2760
  49.       Width           =   1095
  50.    End
  51.    Begin ComctlLib.ImageList ImageList1 
  52.       Left            =   2520
  53.       Top             =   2040
  54.       _ExtentX        =   1005
  55.       _ExtentY        =   1005
  56.       BackColor       =   -2147483643
  57.       ImageWidth      =   16
  58.       ImageHeight     =   16
  59.       MaskColor       =   12632256
  60.       _Version        =   327682
  61.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  62.          NumListImages   =   7
  63.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  64.             Picture         =   "frmEx2.frx":08B4
  65.             Key             =   ""
  66.          EndProperty
  67.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  68.             Picture         =   "frmEx2.frx":0BCE
  69.             Key             =   ""
  70.          EndProperty
  71.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  72.             Picture         =   "frmEx2.frx":0EE8
  73.             Key             =   ""
  74.          EndProperty
  75.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  76.             Picture         =   "frmEx2.frx":1202
  77.             Key             =   ""
  78.          EndProperty
  79.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  80.             Picture         =   "frmEx2.frx":151C
  81.             Key             =   ""
  82.          EndProperty
  83.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  84.             Picture         =   "frmEx2.frx":1836
  85.             Key             =   ""
  86.          EndProperty
  87.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  88.             Picture         =   "frmEx2.frx":1B50
  89.             Key             =   ""
  90.          EndProperty
  91.       EndProperty
  92.    End
  93.    Begin VB.Label Label1 
  94.       Caption         =   $"frmEx2.frx":1E6A
  95.       BeginProperty Font 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   8.25
  98.          Charset         =   0
  99.          Weight          =   700
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       Height          =   660
  105.       Left            =   120
  106.       TabIndex        =   5
  107.       Top             =   1440
  108.       Width           =   5055
  109.    End
  110.    Begin VB.Image Image1 
  111.       Height          =   480
  112.       Left            =   120
  113.       Picture         =   "frmEx2.frx":1F06
  114.       Top             =   2160
  115.       Width           =   480
  116.    End
  117.    Begin VB.Label Label4 
  118.       Caption         =   $"frmEx2.frx":2348
  119.       BeginProperty Font 
  120.          Name            =   "MS Sans Serif"
  121.          Size            =   8.25
  122.          Charset         =   0
  123.          Weight          =   700
  124.          Underline       =   0   'False
  125.          Italic          =   0   'False
  126.          Strikethrough   =   0   'False
  127.       EndProperty
  128.       Height          =   780
  129.       Left            =   120
  130.       TabIndex        =   2
  131.       Top             =   600
  132.       Width           =   5055
  133.    End
  134.    Begin VB.Label Label3 
  135.       Caption         =   "This example application shows just how easy it is to use the SysTray control in your own application."
  136.       BeginProperty Font 
  137.          Name            =   "MS Sans Serif"
  138.          Size            =   8.25
  139.          Charset         =   0
  140.          Weight          =   700
  141.          Underline       =   0   'False
  142.          Italic          =   0   'False
  143.          Strikethrough   =   0   'False
  144.       EndProperty
  145.       Height          =   495
  146.       Left            =   120
  147.       TabIndex        =   0
  148.       Top             =   120
  149.       Width           =   5055
  150.    End
  151. Attribute VB_Name = "frmEx2"
  152. Attribute VB_GlobalNameSpace = False
  153. Attribute VB_Creatable = False
  154. Attribute VB_PredeclaredId = True
  155. Attribute VB_Exposed = False
  156. Option Explicit
  157. 'Example program for SysTray Control
  158. '(C) Copyright 1998 Charon Software, All Rights Reserved
  159. 'You may use or modify this code in any way you see fit.
  160. 'Charon Software takes no responsibility for what you may
  161. 'do with this or any modification of this code.
  162. 'Please note that the ShowInTaskbar property of this form
  163. 'is False; if it weren't, the window would zoom to the
  164. 'system tray and then the taskbar icon would disappear.
  165. 'It is designed to work either way.
  166. 'Also note that zooming the window to the system tray does
  167. 'not actually minimize the window: it just hides it.
  168. Private Sub cmdAnimate_Click()
  169.     'we change the caption on the command button to let the
  170.     'user simply click it to start (and then stop) the
  171.     'animation.  ImageList1 is the imagelist we have on our
  172.     'form, with the icons for the animation.  120 is the
  173.     'number of milliseconds to pause between each frame.
  174.     If cmdAnimate.Caption = "Animate Icon" Then
  175.         csSysTray1.StartAnimation ImageList1, 120
  176.         cmdAnimate.Caption = "Stop Animation"
  177.     Else
  178.         csSysTray1.StopAnimation
  179.         cmdAnimate.Caption = "Animate Icon"
  180.     End If
  181. End Sub
  182. Private Sub cmdClose_Click()
  183.     'pretty simple, just unload my form.  The system tray
  184.     'icons will go away automatically!
  185.     Unload Me
  186. End Sub
  187. Private Sub cmdZoomToTray_Click()
  188.     'zoom the window to the system tray.
  189.     csSysTray1.ZoomToTray Me.hWnd
  190. End Sub
  191. Private Sub csSysTray1_Click()
  192.     'when the user clicks on the system tray icon, we
  193.     'want to zoom the window to/from the system tray.
  194.     'note: when we zoom the window to/from the tray, we
  195.     'simply hide or show it, respectively.  We do not
  196.     'change its WindowState property nor unload it.
  197.     If Me.Visible = False Then
  198.         csSysTray1.ZoomFromTray Me.hWnd
  199.     Else
  200.         csSysTray1.ZoomToTray Me.hWnd
  201.     End If
  202. End Sub
  203. Private Sub Form_Load()
  204.     csSysTray1.AddMinimizeWatch Me.hWnd 'if a user presses "my" minimize button,
  205.                                         'I want to zoom to tray instead.
  206.                                         'Also, I could remove myself in my unload
  207.                                         'event, although it isn't necessary.
  208.                                         'Visual Basic and the SysTray control do it
  209.                                         'all automatically for you upon unload!
  210. End Sub
  211. Private Sub Form_Unload(Cancel As Integer)
  212. ' we could remove our "minimize watch" like the following, but we don't need to.
  213. '    csSysTray1.RemoveMinimizeWatch Me 'see Form_Load -- not necessary.
  214.     'for added effect, we'll zoom to the tray on exit
  215.     csSysTray1.ZoomToTray Me.hWnd
  216. End Sub
  217.